cmake_minimum_required(VERSION 3.8)
project(qrodom)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

set(THIS_PACKAGE_INCLUDE_DEPENDS
  rclcpp
  std_msgs
  nav_msgs
  tf2
  agv_srvs
  agv_msgs
  sensor_msgs
  geometry_msgs
  tf2_geometry_msgs
  transform
  shared_parameters
)

find_package(ament_cmake REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS system)

foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
  find_package(${Dependency} REQUIRED)
endforeach()

add_executable(qrodom 
  src/qrodom.cpp
)

target_include_directories(${PROJECT_NAME} PRIVATE include)

# add_executable(qrodom_test 
#   src/qrodom_test.cpp
# )

target_include_directories(qrodom PRIVATE
  include
  ${YAML_CPP_INCLUDE_DIR}
  ${tinyxml2_INCLUDE_DIRS}
)

# target_include_directories(qrodom_test PRIVATE
#   include
#   ${EIGEN3_INCLUDE_DIRS}
#   ${YAML_CPP_INCLUDE_DIR}
#   ${tinyxml2_INCLUDE_DIRS}
# )

target_link_libraries(qrodom
  ${OpenCV_LIBS}
  ${PROJECT_SOURCE_DIR}/libzbar.a
  yaml-cpp
  tinyxml2
)

# target_link_libraries(qrodom_test
#   ${OpenCV_LIBS}
#   ${PROJECT_SOURCE_DIR}/libzbar.a
#   yaml-cpp
#   Eigen3::Eigen
#   #tinyxml2::tinyxml2
# )

ament_target_dependencies(qrodom
  ${THIS_PACKAGE_INCLUDE_DEPENDS}
)

# ament_target_dependencies(qrodom_test
#   rclcpp
#   std_msgs
#   geometry_msgs
#   sensor_msgs
#   nav_msgs
#   tf2_ros
#   agv_msgs
#   agv_srvs
# )

install(TARGETS 
  qrodom 
  # qrodom_test
  DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY 
  launch
  DESTINATION share/${PROJECT_NAME}
)


ament_export_include_directories(include)
ament_export_dependencies(
  rclcpp
  std_msgs
  geometry_msgs
  sensor_msgs
  nav_msgs
  tf2_ros
  yaml-cpp
  OpenCV
  tinyxml2
  agv_msgs
  agv_srvs
)

ament_package()